<?php echo $this->Html->css('web/org_subscription.css'); ?>
<?php

$signup_info = $this->Session->read('signup_info');
$organisation = null;

if (isset($signup_info) && isset($signup_info['Organisation'])) {
    $organisation = $signup_info['Organisation'];
}
?>

<?php //echo $this->element('organisation/web/register_steps', array('active' => 'info')); ?>

<div class="b-b m-b text-center">
    <h2>Organisation Information</h2>
    <p>Please provide information about your organisation.</p>
</div>

<div class="clearfix col-lg-10 col-lg-offset-1">
    
    
    <?php 
    $flash = $this->Session->flash();
    
    if( $flash ) {
        echo "<div class='alert alert-danger'>$flash</div>";
    }
    ?>

    <form class='form-horizontal' data-validate="parsley" method="post" action="<?php echo $this->Html->url(array('controller' => 'organisation', 'action' => 'create_profile')); ?>" >
        <section class="panel m-b-none no-border">
            <div class="panel-body">
                <div class="col-lg-12">
                    <!--<h4>Your Organization Details</h4>-->

                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>* Name:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][name]" class="form-control input-sm input-s-lg" required placeholder="Full Organisation Name" value="<?php echo isset($organisation) ? $organisation['Organisation']['name'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>* Type:</div>
                        <div class='col-lg-9 controls'>
                            <select name="data[Organisation][organisation_type_id]" required class="form-control input-sm input-s-lg">
                                <option value="">Choose Organisation Type</option>
                                <?php
                                $organisation_types = ClassRegistry::init('OrganisationType')->find('list', array(
                                    'order' => array('OrganisationType.name' => 'asc')
                                ));

                                foreach ($organisation_types as $id => $name) {
                                    $selected = isset($organisation) && $organisation['Organisation']['organisation_type_id'] == $id ? "selected" : "";
                                    echo "<option value='$id' $selected>$name</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>

                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>* Email:</div>
                        <div class='col-lg-9 controls'>
                            <input type="email" name="data[Organisation][email]" class="form-control input-sm input-s-lg" required placeholder="Primary Contact Address" value="<?php echo isset($organisation) ? $organisation['Organisation']['email'] : ''; ?>" />
                        </div>
                    </div>
                    
                    
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>* Country:</div>
                        <div class='col-lg-9 controls'>
                            <select name="data[Organisation][country]" class="select2 input-s-lg text-sm">
                                <option value="">Select Country</option>
                                <?php $val = isset($organisation) ? $organisation['Organisation']['country'] : 'GH'; ?>
                                <?php echo $this->Dropdown->generateCountries($val); ?>
                            </select>
                            
                            <!-- <input type="text" name="data[Organisation][country]" class="form-control input-sm input-s-lg" required placeholder="Country" value="<?php echo isset($organisation) ? $organisation['Organisation']['country'] : ''; ?>" />-->
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Address:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][address]" class="form-control input-sm input-s-lg" placeholder="Business address" value="<?php echo isset($organisation) ? $organisation['Organisation']['address'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>City:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][city]" class="form-control input-sm input-s-lg" placeholder="City" value="<?php echo isset($organisation) ? $organisation['Organisation']['city'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>State / Region:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][state]" class="form-control input-sm input-s" placeholder="Region / State" value="<?php echo isset($organisation) ? $organisation['Organisation']['state'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Post / Zip Code:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][post_code]" class="form-control input-sm input-s-sm" placeholder="Post Code" value="<?php echo isset($organisation) ? $organisation['Organisation']['post_code'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Phone:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][phone]" class="form-control input-sm input-s-lg" placeholder="Phone number" value="<?php echo isset($organisation) ? $organisation['Organisation']['phone'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Website URL:</div>
                        <div class='col-lg-9 controls'>
                            <input type="text" name="data[Organisation][website]" class="form-control input-sm input-s-lg" placeholder="[URL]" value="<?php echo isset($organisation) ? $organisation['Organisation']['website'] : ''; ?>" />
                        </div>
                    </div>
                </div>

                <!--<div class="col-lg-6">

                    <h4>Primary Login Account</h4>

                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Your Name:</div>
                        <div class='col-lg-9 controls form-inline'>
                            <input type="text" name="data[OrganisationAccount][0][first_name]" class='form-control input-s-sm input-sm' placeholder='First Name' required value="<?php echo isset($organisation) ? $organisation['OrganisationAccount'][0]['first_name'] : ''; ?>" />
                            <input type='text' name='data[OrganisationAccount][0][last_name]' class='form-control input-s-sm input-sm' placeholder='Last Name' required value="<?php echo isset($organisation) ? $organisation['OrganisationAccount'][0]['last_name'] : ''; ?>" />
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Date of Birth:</div>
                        <div class='col-lg-9 controls form-inline'>
                            <input type="text" class="combodate form-control input-sm" required="" data-format="YYYY-MM-DD" data-template="MMM DD YYYY" name="data[Member][dob]" value="<?php echo isset($organisation) ? $organisation['Member']['dob'] : ''; ?>">
                        </div>
                    </div>
                    
                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Gender:</div>
                        <div class='col-lg-9 controls form-inline'>
                            <select name="data[Member][gender]" required="" class="form-control input-s-sm input-sm">
                                    <option value="">Choose Gender</option>
                                    <option value="Male" <?php echo isset($organisation) && $organisation['Member']['gender'] == 'Male' ? 'selected' : ''; ?>>Male</option>
                                    <option value="Female" <?php echo isset($organisation) && $organisation['Member']['gender'] == 'Female' ? 'selected' : ''; ?>>Female</option>
                                </select>
                        </div>
                    </div>

                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Username (Email):</div>
                        <div class='col-lg-9 controls'>
                            <input type="email" name="data[OrganisationAccount][0][username]" class="form-control input-s-lg input-sm" required placeholder="Username" value="<?php echo isset($organisation) ? $organisation['OrganisationAccount'][0]['username'] : ''; ?>" />
                        </div>
                    </div>

                    <div class='form-group'>
                        <div class='col-lg-3 control-label text-sm'>Password:</div>
                        <div class='col-lg-9 controls'>
                            <input type="password" name="data[OrganisationAccount][0][password]" class="form-control input-s-lg input-sm" required placeholder="Password" />
                            <input type="hidden" name="data[OrganisationAccount][0][pass_salt]" value="<?php echo rand(10000, 99999); ?>" />
                            <input type="hidden" name="data[OrganisationAccount][0][type]" value="primary" />
                            <input type="hidden" name="data[OrganisationAccount][0][active]" value="1" />
                        </div>
                    </div>

                </div>-->
            </div>

            <div class='panel-footer text-right'>
                <!--<a class='btn btn-default btn-sm' href='<?php echo $this->Html->url(array('action' => 'create_subscription')); ?>'><i class='fa fa-backward'></i> Back</a>-->
                <button type="submit" class="btn btn-success btn-sm"><i class='fa fa-forward'></i> Continue</button>
                <a class="btn btn-cancel btn-danger btn-sm" href='<?php echo $this->Html->url(array('action' => 'create_cancel')); ?>' >Cancel</a>
            </div>

        </section>
    </form>

</div>
